package mmc.action.skill;

import mmc.server.RemoteClient;

public class RocketLauncher extends Skill {
	
	public RocketLauncher(){
		super("RocketLauncher", "mmc/resource/data/rocket.png", 1);
		this.needTarget = false;
	}
	
	@Override
	public void endCast(RemoteClient client) {
		mmc.server.Player player = client.getPlayer();
		
		float v = 50;
		
		float vy = (float) Math.sin(Math.toRadians(player.pitch));
		float vx = (float) (Math.sin(Math.toRadians(player.yaw)) *Math.cos(Math.toRadians(player.pitch)));
		float vz = -(float) (Math.cos(Math.toRadians(player.yaw)) *Math.cos(Math.toRadians(player.pitch)));
		
		client.getServer().getScene().addObject(new mmc.objects.Rocket(player.x,player.y+1.99f,player.z,player.vx+vx*v,player.vy+vy*v,player.vz+vz*v));
	}
}
